using UnityEngine;
using System.Collections;
using UnityEditor;

[CustomEditor(typeof(Objeto))]
public class ObjetoEditor: Editor{

    // Use this for initialization
	void Start () {
	
	}

	public override void OnInspectorGUI()
    {
        DrawDefaultInspector();

        if (((Objeto)target).transform.localScale.x == 1 && ((Objeto)target).transform.localScale.z == 1 && ((Objeto)target).renderer != null)
        {
            Texture text = ((Objeto)target).renderer.materials[0].mainTexture;
				
			if(text == null) return;
			
			Debug.Log(text.width + " " + text.height);
            ((Objeto)target).transform.localScale = new Vector3((float)text.width / (float)100, 1, -(float)text.height / (float)100);
        }
    }
   
	// Update is called once per frame
	void Update () {

        
	}
}
